package com.example.wan1.view.system;

import com.example.wan1.R;
import com.example.wan1.adapter.ArticleListAdapter;
import com.example.wan1.adapter.NaviAdapter;
import com.example.wan1.base.adapter.SubPagerAdapter;
import com.example.wan1.di.ano.FragmentScope;
import com.example.wan1.model.ArticleBean;
import com.example.wan1.model.NaviBean;
import com.example.wan1.model.WebsiteBean;
import com.example.wan1.view.system.navi.NaviContract;
import com.example.wan1.view.system.navi.NaviFragment;
import com.example.wan1.view.system.question.QuestionContract;
import com.example.wan1.view.system.question.QuestionFragment;
import com.example.wan1.view.system.website.WebsiteContract;
import com.example.wan1.view.system.website.WebsiteFragment;

import java.util.ArrayList;
import java.util.List;

import androidx.fragment.app.Fragment;
import dagger.Binds;
import dagger.Module;
import dagger.Provides;

import static androidx.fragment.app.FragmentStatePagerAdapter.BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT;

/***
 * @Author: zxd
 * @CreateDate: 2020/8/26 15:49
 * @Description:
 */
@Module
public abstract class SystemModule {

    //system知识体系tab
    @FragmentScope
    @Provides
    static SubPagerAdapter provideAdapter(SystemFragment system) {
        return new SubPagerAdapter(system.getChildFragmentManager(),
                BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT);
    }

    @FragmentScope
    @Provides
    static List<String> provideTitleList() {
        return new ArrayList<>();
    }

    @FragmentScope
    @Provides
    static List<Fragment> provideFragmentList() {
        return new ArrayList<>();
    }

    //Website常用网站
    @FragmentScope
    @Provides
    static List<WebsiteBean> provideWebsiteList() {
        return new ArrayList<>();
    }

    @Binds
    abstract WebsiteContract.View websiteView(WebsiteFragment websiteFragment);

    //question问答
    @FragmentScope
    @Provides
    static ArticleListAdapter provideArticleAdapter(List<ArticleBean> list) {
        return new ArticleListAdapter(R.layout.article_item, list);
    }

    @FragmentScope
    @Provides
    static List<ArticleBean> provideArticleList() {
        return new ArrayList<>();
    }

    @Binds
    abstract QuestionContract.View questionView(QuestionFragment questionFragment);

    //导航
    @Binds
    abstract NaviContract.View naviView(NaviFragment naviFragment);

    @FragmentScope
    @Provides
    static NaviAdapter provideNaviAdapter(List<NaviBean> list) {
        return new NaviAdapter(R.layout.navi_rv_item, list);
    }

    @FragmentScope
    @Provides
    static List<NaviBean> provideNaviList() {
        return new ArrayList<>();
    }
}
